package com.neo.web;

import com.alibaba.fastjson.JSONObject;
import com.neo.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;

/**
 * 测试resttemplate 功能
 */
@Controller
public class TestController {


    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private TestService testService;

    @RequestMapping("/test-rest-template")
    public String test() {

        String url = "http://localhost:8080/TouchStoneServiceNew/jxLoanPeopleInfo/detail?projectNo=BD20180207065150000679";
        JSONObject json = restTemplate.getForEntity(url, JSONObject.class).getBody();
        return json.toJSONString();
    }

    @RequestMapping("/update-amount")
    @ResponseBody
    public int test2() {
        //testService.update1(40);
        return 0;
    }
}
